package com.xuecheng.content.controller;

import com.xuecheng.content.dto.AddCourseTeacher;
import com.xuecheng.content.entity.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName CourseTeachgerController
 * @Description 师资信息
 * @Author CG
 * @Date 2023/11/27 14:57
 **/
@Api(value = "教师设置编辑接口",tags = "教师设置编辑接口")
@RestController
public class CourseTeachgerController {


    @Resource
    private CourseTeacherService courseTeacherService;


    @ApiOperation(("根据课程id查询师资信息接口"))
    @GetMapping("/courseTeacher/list/{id}")
    public List<CourseTeacher> findCourseTeacherByCourseId(@PathVariable("id") Long courseId){
        return courseTeacherService.findCourseTeacherByCourseId(courseId);
    }


    @ApiOperation("添加教师信息接口")
    @PostMapping("/courseTeacher")
    public List<CourseTeacher> insertTeacher(@RequestBody AddCourseTeacher addCourseTeacher){
        return courseTeacherService.insertTeacher(addCourseTeacher);
    }


    @ApiOperation("修改教师信息接口")
    @PutMapping("/courseTeacher")
    public List<CourseTeacher> updateTeacher(@RequestBody CourseTeacher courseTeacher){
        return courseTeacherService.updateTeacher(courseTeacher);
    }


    @ApiOperation("删除教师信息接口")
    @DeleteMapping("/courseTeacher/course/{courseId}/{id}")//courseTeacher/course/1/27
    public void deleteTeacher(@PathVariable("courseId") Long courseId, @PathVariable("id") Long id){
        courseTeacherService.deleteTeacher(courseId,id);
    }



}
